<?php
define('IN_QY',true);
session_start();
require("include/common.inc.php");
require_once('config.php');
require_once('qq.php');
include_once( 'wbconfig.php' );
include_once( 'saetv2.ex.class.php' );
$o = new SaeTOAuthV2( WB_AKEY , WB_SKEY );
$code_url = $o->getAuthorizeURL( WB_CALLBACK_URL );
if($qq_t!=''){
	$qq=new qqPHP($qq_k, $qq_s, $qq_t);
	$qq_oid=$qq->get_openid();
	$openid=$qq_oid['openid']; //获取登录用户open id
	//获取登录用户信息
	$result=$qq->get_user_info($openid);
//	 echo "<script type='text/javascript'>alert('使用QQ快捷登录成功');location.href='qqwelcome.php';</script>";
//    exit;
}else{
	//生成登录链接
	$qq=new qqPHP($qq_k, $qq_s);
	$login_url=$qq->login_url($callback_url, $scope);
}
if($_GET['act']=='login'){
    $sql = "select * from tbl_user where userid ='".$_POST['userid']."' AND userpwd ='".$_POST['userpwd']."'";
    $query = mysql_query($sql);
    $row = mysql_fetch_array($query);
    if($row){   
    setcookie("username",$row['userid'],time()+(3600*8*1*1),"/");
    setcookie("userid",$row['id'],time()+(3600*8*1*1),"/");
    setcookie("shuyu",$row['shuyu'],time()+(3600*8*1*1),"/");  
    setcookie("addmima",strtotime($row['change_pwd_time']),time()+(3600*8*1*1),"/");   
//	
		if($_COOKIE['popped']){
		echo "<script type='text/javascript'>location.href='".$_COOKIE['popped']."';</script>";		
		}else {	
		echo "<script type='text/javascript'>location.href='mlogin.php';</script>";	
		}
    } else{
		echo "<script type='text/javascript'>alert('用户名或密码不正确');location.href='mlogin.php';</script>";
		exit;
	}
}

if($_COOKIE['userid']){
		echo "<script type='text/javascript'>location.href='main.php';</script>";
	exit;
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>会员登录-众晒网</title>
		<link rel="stylesheet" href="/ui/login/css/base.css" />
		    <style>
			::-webkit-input-placeholder {
    /* WebKit browsers */
    color: #CCCCCC!important;
}

:-moz-placeholder {
    /* Mozilla Firefox 4 to 18 */
    color: #CCCCCC!important;
}

::-moz-placeholder {
    /* Mozilla Firefox 19+ */
    color: #CCCCCC!important;
}

:-ms-input-placeholder {
    /* Internet Explorer 10+ */
   color: #CCCCCC!important;
}

			#geetest_holder geetest_wind geetest_radar_click_hide{
			  width:  261px;	
			}
          #embed-captcha {
            width:  261px;
            margin: 7px auto;
        }
        .show {
            display: block;
        }
        .hide {
            display: none;
        }
		.t {
            margin-left:13px;
			text-decoration:none;
        }
		.nav {
    margin-top: 16%;
    height: auto;
    overflow: hidden;
    padding-bottom: 2rem;
        }
    .nav ul {
    height: auto;
    overflow: hidden;
    clear: both;
      }
.nav ul li {
    width: 15%;
    float: left;
    margin-left: 13%;
    font-size: 1.2rem;
    text-align: center;
    margin-top: 2rem;
    line-height: 1.5rem;
}	
.nav ul li img {
    width: 100%;
    -webkit-animation-delay: 1.5s;
    -webkit-animation-duration: 2s;
}  
        #notice {
            color: red;
        }



a{
	text-decoration:none;
	color:#FE984C;


}


    </style>	
	</head>
	<body>
		<div class="bg_bank">
                  <a class="re_bank" href="javascirpt:;" onclick="javascript:history.back(-1);"></a>
		  <div class="re_min_infor">
		  	<form  action="?act=login" method="post"  name="myform" onSubmit="return beforeSubmit(this);"> 
			    <div class="bg_color">
                                <div class="re_min">
                                    <span class="icon_phone"></span>
                                    <input class="input01" name="userid" type="text" placeholder="请输入手机号" /><div id="div1"></div>
                                </div>
                                <div class="re_min">
                                    <span class="icon_passwarde"></span>
                                    <input class="input01" name="userpwd" type="password" placeholder="请输入密码" />
                                  
                                </div>			
                                <div class="re_min" id="embed-captcha" name="embed-captcha">
                             <p id="wait" class="show">正在加载验证码......</p>
		                     <p id="notice" class="hide">请先完成验证</p>
                                </div>
                            </div>
                            <div class="re_regist" style="margin-top:-23px;">
                                <button class="btn_regist" id="embed-submit" type="submit">登录</button>
                            </div>
                            <div class="re_regist02">
							<!------------
                                <a class="t" id="dl"  style="text-decoration:none;color: #fe984c;">注册</a>  
                            ------------------------>
								<a class="t" href="mmregister.php"  style="text-decoration:none;color: #fe984c;">注册</a>
								
                                <a class="t" id="dl" href="yzmlogin.php" style="text-decoration:none;">验证码登录</a>  								
								<a class="t" href="https://www.sobot.com/chat/h5/index.html?sysNum=ec36cd7ac75e471481dbe6ed6704dbf4" style="text-decoration:none;color: #fe984c;" >客服</a>  
								
								<a class="t" href="xiugaimima.php"  style="text-decoration:none;color: #fe984c;">忘记密码</a>
                            </div>
			<div class="nav">
							 <ul>
            <li>
                <a href="<?=$login_url?>">
                    <p><img src="/ui/login/img/icon_QQ登录@3x.png" class="animated bounceIn"></p>
                </a>
            </li>
            <li>
					 <?php
		 
		 // 是否微信中打开
function is_weixin() {
   if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
       return true;
    } return false;
 }
 $is_weixin = (is_weixin() == true) ? "1" : "2";	
 ?>	
  <?php
 if($is_weixin==1){
	 	?> 
                <a href="wxlogin.php">
                    <p><img src="/ui/login/img/微信登录@3x.png" class="animated rotateIn"></p>
                </a>
  <?php } ?>
 <?php
 if($is_weixin==2){
	?> 	
                <a href="javascirpt:;" onclick="alert('请在微信APP中打开!');">
                    <p><img src="/ui/login/img/微信登录@3x.png" class="animated rotateIn"></p>
                </a>
		  <?php } ?>				
            </li>
            <li>
                <a href="<?=$code_url?>">
                    <p><img src="/ui/login/img/微博登录@3x.png" class="animated rotateIn"></p>
                </a>
            </li>
        </ul>					
		</div>
			</form>				
		  </div>
		</div>	
    <script src="/ui/js/ui.js"></script>
    <script src="static/gt.js"></script>	
    <script src="/wap/dl/lib/jquery-2.1.4.js"></script>	
	<script src="/wap/dl/lib/fastclick.js"></script>	
    <script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>    	
 <script>
var _mtac = {};
(function() {
    var mta = document.createElement("script");
    mta.src = "http://pingjs.qq.com/h5/stats.js?v2.0.2";
    mta.setAttribute("name", "MTAH5");
    mta.setAttribute("sid", "500475478");
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(mta, s);
})();
</script>
<!-- 这是美洽的嵌入代码 -->
<script>
    var handlerEmbed = function (captchaObj) {
        $("#embed-submit").click(function (e) {
            var validate = captchaObj.getValidate();
            if (!validate) {
                $("#notice")[0].className = "show";
                setTimeout(function () {
                    $("#notice")[0].className = "hide";
                }, 2000);
                e.preventDefault();
            }
        });
        // 将验证码加到id为captcha的元素里，同时会有三个input的值：geetest_challenge, geetest_validate, geetest_seccode
        captchaObj.appendTo("#embed-captcha");
        captchaObj.onReady(function () {
            $("#wait")[0].className = "hide";
        });
        // 更多接口参考：http://www.geetest.com/install/sections/idx-client-sdk.html
    };
    $.ajax({
        // 获取id，challenge，success（是否启用failback）
        url: "yz/StartCaptchaServlet.php?t=" + (new Date()).getTime(), // 加随机数防止缓存
        type: "get",
        dataType: "json",
        success: function (data) {
            console.log(data);
            // 使用initGeetest接口
            // 参数1：配置参数
            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
            initGeetest({
                gt: data.gt,
                challenge: data.challenge,
                new_captcha: data.new_captcha,
                product: "embed", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效
                offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注
                // 更多配置参数请参见：http://www.geetest.com/install/sections/idx-client-sdk.html#config
            }, handlerEmbed);
        }
    });
</script>
	<script type="text/javascript">

	  $('#dl').on('click', function(){
		  
//		  
  layer.open({
    title: [
      '选择注册类型',
      'background-color: #fd974c; color:#fff;'
    ]
    ,content: '<div class="nav" style="margin-top:-36px;padding-bottom:0px;width:100%;"><ul><li><a href="mmregister.php"><p><img src="/ui/login/img/geren.png" class="animated bounceIn"></p><span style="color: #fe984c;">个人</span></a></li> <li><a href="mmregistergt.php"><p><img src="/ui/login/img/geti.png" class="animated rotateIn"></p><span style="color: #fe984c;">个体</span></a></li><li><a href="mmregisterqy.php"><p><img src="/ui/login/img/qiye.png" class="animated rotateIn"></p> <span style="color: #fe984c;">企业</span></a></li></ul></div>'
  });
	
	
//	
	
  });
	
//	
	
	
function beforeSubmit(form){
if(form.userid.value==''){

  layer.open({
    content: '请填写手机号'
    ,skin: 'msg'
    ,time: 2 //2秒后自动关闭
  });



return false;

}
if(form.userpwd.value==''){

  layer.open({
    content: '请填写密码'
    ,skin: 'msg'
    ,time: 2 //2秒后自动关闭
  });



return false;

}

return true;

}

</script> 		
	</body>
</html>